package com.xy.p2p.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.p2p.dao.TfileaveamessageDao;
import com.xy.p2p.model.Tfileaveamessage;
import com.xy.p2p.service.TfileaveamessageService;

@Service
@Transactional
public class TfileaveamessageServiceImpl extends BaseServiceImpl<Tfileaveamessage> implements
		TfileaveamessageService {
	private TfileaveamessageDao tfileaveamessageDao;

	public TfileaveamessageServiceImpl(TfileaveamessageDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tfileaveamessageDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tfileaveamessageDao.checkExist("Tfileaveamessage", paraName, paraValue);
	}

	@Override
	public List<Tfileaveamessage> getTfileaveamessage(Map<String, Object> map) {
		return tfileaveamessageDao.getTfileaveamessage(map);
	}
	@Override
	public Pagination getTfileaveamessageByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tfileaveamessageDao.getTfileaveamessageByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tfileaveamessage save(Tfileaveamessage tfileaveamessage) {
//		tfileaveamessage.setModtime(new Date());
		if(tfileaveamessage.getFilmid()==null){
			//新增
        	return super.save(tfileaveamessage);
		}else{
			//更新
			Tfileaveamessage tfileaveamessage1=tfileaveamessageDao.get(tfileaveamessage.getFilmid());
			try {
				BeanUtil.copyNotNullProperties(tfileaveamessage1, tfileaveamessage);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tfileaveamessage1);
		}
	}
}